//
// CLandscapeUser.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CRGBA;
import org.ryzom.nel.misc.CVector;

public class CLandscapeUser {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CLandscapeUser(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CLandscapeUser obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CLandscapeUser(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public CLandscapeUser(CScene scene) {
    this(nel3dJNI.new_CLandscapeUser(CScene.getCPtr(scene), scene), true);
  }

  public void setZonePath(String zonePath) {
    nel3dJNI.CLandscapeUser_setZonePath(swigCPtr, this, zonePath);
  }

  public void loadBankFiles(String tileBankFile, String farBankFile) {
    nel3dJNI.CLandscapeUser_loadBankFiles(swigCPtr, this, tileBankFile, farBankFile);
  }

  public void flushTiles(SWIGTYPE_p_NLMISC__IProgressCallback progress) {
    nel3dJNI.CLandscapeUser_flushTiles(swigCPtr, this, SWIGTYPE_p_NLMISC__IProgressCallback.getCPtr(progress));
  }

  public void postfixTileFilename(String postfix) {
    nel3dJNI.CLandscapeUser_postfixTileFilename(swigCPtr, this, postfix);
  }

  public void postfixTileVegetableDesc(String postfix) {
    nel3dJNI.CLandscapeUser_postfixTileVegetableDesc(swigCPtr, this, postfix);
  }

  public void loadAllZonesAround(CVector pos, float radius) {
    nel3dJNI.CLandscapeUser_loadAllZonesAround__SWIG_0(swigCPtr, this, CVector.getCPtr(pos), pos, radius);
  }

  public void loadAllZonesAround(CVector pos, float radius, Vector_String zonesAdded) {
    nel3dJNI.CLandscapeUser_loadAllZonesAround__SWIG_1(swigCPtr, this, CVector.getCPtr(pos), pos, radius, Vector_String.getCPtr(zonesAdded), zonesAdded);
  }

  public void refreshZonesAround(CVector pos, float radius) {
    nel3dJNI.CLandscapeUser_refreshZonesAround__SWIG_0(swigCPtr, this, CVector.getCPtr(pos), pos, radius);
  }

  public void refreshZonesAround(CVector pos, float radius, SWIGTYPE_p_std__string zoneAdded, SWIGTYPE_p_std__string zoneRemoved, Vector_uint16 validZoneIds) {
    nel3dJNI.CLandscapeUser_refreshZonesAround__SWIG_1(swigCPtr, this, CVector.getCPtr(pos), pos, radius, SWIGTYPE_p_std__string.getCPtr(zoneAdded), SWIGTYPE_p_std__string.getCPtr(zoneRemoved), Vector_uint16.getCPtr(validZoneIds), validZoneIds);
  }

  public void refreshZonesAround(CVector pos, float radius, SWIGTYPE_p_std__string zoneAdded, SWIGTYPE_p_std__string zoneRemoved) {
    nel3dJNI.CLandscapeUser_refreshZonesAround__SWIG_2(swigCPtr, this, CVector.getCPtr(pos), pos, radius, SWIGTYPE_p_std__string.getCPtr(zoneAdded), SWIGTYPE_p_std__string.getCPtr(zoneRemoved));
  }

  public void refreshAllZonesAround(CVector pos, float radius, Vector_String zonesAdded, Vector_String zonesRemoved, SWIGTYPE_p_NLMISC__IProgressCallback progress, Vector_uint16 validZoneIds) {
    nel3dJNI.CLandscapeUser_refreshAllZonesAround__SWIG_0(swigCPtr, this, CVector.getCPtr(pos), pos, radius, Vector_String.getCPtr(zonesAdded), zonesAdded, Vector_String.getCPtr(zonesRemoved), zonesRemoved, SWIGTYPE_p_NLMISC__IProgressCallback.getCPtr(progress), Vector_uint16.getCPtr(validZoneIds), validZoneIds);
  }

  public void refreshAllZonesAround(CVector pos, float radius, Vector_String zonesAdded, Vector_String zonesRemoved, SWIGTYPE_p_NLMISC__IProgressCallback progress) {
    nel3dJNI.CLandscapeUser_refreshAllZonesAround__SWIG_1(swigCPtr, this, CVector.getCPtr(pos), pos, radius, Vector_String.getCPtr(zonesAdded), zonesAdded, Vector_String.getCPtr(zonesRemoved), zonesRemoved, SWIGTYPE_p_NLMISC__IProgressCallback.getCPtr(progress));
  }

  public void getAllZoneLoaded(Vector_String zoneLoaded) {
    nel3dJNI.CLandscapeUser_getAllZoneLoaded(swigCPtr, this, Vector_String.getCPtr(zoneLoaded), zoneLoaded);
  }

  public void invalidateAllTiles() {
    nel3dJNI.CLandscapeUser_invalidateAllTiles(swigCPtr, this);
  }

  public void removeAllZones() {
    nel3dJNI.CLandscapeUser_removeAllZones(swigCPtr, this);
  }

  public void setupStaticLight(CRGBA diffuse, CRGBA ambiant, float multiply) {
    nel3dJNI.CLandscapeUser_setupStaticLight(swigCPtr, this, CRGBA.getCPtr(diffuse), diffuse, CRGBA.getCPtr(ambiant), ambiant, multiply);
  }

  public void setPointLightDiffuseMaterial(CRGBA diffuse) {
    nel3dJNI.CLandscapeUser_setPointLightDiffuseMaterial(swigCPtr, this, CRGBA.getCPtr(diffuse), diffuse);
  }

  public CRGBA getPointLightDiffuseMaterial() {
    return new CRGBA(nel3dJNI.CLandscapeUser_getPointLightDiffuseMaterial(swigCPtr, this), true);
  }

  public void setUpdateLightingFrequency(float freq) {
    nel3dJNI.CLandscapeUser_setUpdateLightingFrequency(swigCPtr, this, freq);
  }

  public void updateLightingAll() {
    nel3dJNI.CLandscapeUser_updateLightingAll(swigCPtr, this);
  }

  public void setThreshold(float thre) {
    nel3dJNI.CLandscapeUser_setThreshold(swigCPtr, this, thre);
  }

  public float getThreshold() {
    return nel3dJNI.CLandscapeUser_getThreshold(swigCPtr, this);
  }

  public void setTileNear(float tileNear) {
    nel3dJNI.CLandscapeUser_setTileNear(swigCPtr, this, tileNear);
  }

  public float getTileNear() {
    return nel3dJNI.CLandscapeUser_getTileNear(swigCPtr, this);
  }

  public void setTileMaxSubdivision(long tileDiv) {
    nel3dJNI.CLandscapeUser_setTileMaxSubdivision(swigCPtr, this, tileDiv);
  }

  public long getTileMaxSubdivision() {
    return nel3dJNI.CLandscapeUser_getTileMaxSubdivision(swigCPtr, this);
  }

  public void setTileColor(boolean monochrome, float factor) {
    nel3dJNI.CLandscapeUser_setTileColor(swigCPtr, this, monochrome, factor);
  }

  public String getZoneName(CVector pos) {
    return nel3dJNI.CLandscapeUser_getZoneName(swigCPtr, this, CVector.getCPtr(pos), pos);
  }

  public void show() {
    nel3dJNI.CLandscapeUser_show(swigCPtr, this);
  }

  public void hide() {
    nel3dJNI.CLandscapeUser_hide(swigCPtr, this);
  }

  public void enableAdditive(boolean enable) {
    nel3dJNI.CLandscapeUser_enableAdditive(swigCPtr, this, enable);
  }

  public boolean isAdditiveEnabled() {
    return nel3dJNI.CLandscapeUser_isAdditiveEnabled(swigCPtr, this);
  }

  public void setRefineCenterAuto(boolean mode) {
    nel3dJNI.CLandscapeUser_setRefineCenterAuto(swigCPtr, this, mode);
  }

  public boolean getRefineCenterAuto() {
    return nel3dJNI.CLandscapeUser_getRefineCenterAuto(swigCPtr, this);
  }

  public void setRefineCenterUser(CVector refineCenter) {
    nel3dJNI.CLandscapeUser_setRefineCenterUser(swigCPtr, this, CVector.getCPtr(refineCenter), refineCenter);
  }

  public CVector getRefineCenterUser() {
    return new CVector(nel3dJNI.CLandscapeUser_getRefineCenterUser(swigCPtr, this), false);
  }

  public CVector getHeightFieldDeltaZ(float x, float y) {
    return new CVector(nel3dJNI.CLandscapeUser_getHeightFieldDeltaZ(swigCPtr, this, x, y), true);
  }

  public void setHeightField(CHeightMap hf) {
    nel3dJNI.CLandscapeUser_setHeightField(swigCPtr, this, CHeightMap.getCPtr(hf), hf);
  }

  public void enableVegetable(boolean enable) {
    nel3dJNI.CLandscapeUser_enableVegetable(swigCPtr, this, enable);
  }

  public void loadVegetableTexture(String textureFileName) {
    nel3dJNI.CLandscapeUser_loadVegetableTexture(swigCPtr, this, textureFileName);
  }

  public void setupVegetableLighting(CRGBA ambient, CRGBA diffuse, CVector directionalLight) {
    nel3dJNI.CLandscapeUser_setupVegetableLighting(swigCPtr, this, CRGBA.getCPtr(ambient), ambient, CRGBA.getCPtr(diffuse), diffuse, CVector.getCPtr(directionalLight), directionalLight);
  }

  public void setVegetableWind(CVector windDir, float windFreq, float windPower, float windBendMin) {
    nel3dJNI.CLandscapeUser_setVegetableWind(swigCPtr, this, CVector.getCPtr(windDir), windDir, windFreq, windPower, windBendMin);
  }

  public void setVegetableUpdateLightingFrequency(float freq) {
    nel3dJNI.CLandscapeUser_setVegetableUpdateLightingFrequency(swigCPtr, this, freq);
  }

  public void setVegetableDensity(float density) {
    nel3dJNI.CLandscapeUser_setVegetableDensity(swigCPtr, this, density);
  }

  public float getVegetableDensity() {
    return nel3dJNI.CLandscapeUser_getVegetableDensity(swigCPtr, this);
  }

  public void setDLMGlobalVegetableColor(CRGBA gvc) {
    nel3dJNI.CLandscapeUser_setDLMGlobalVegetableColor(swigCPtr, this, CRGBA.getCPtr(gvc), gvc);
  }

  public CRGBA getDLMGlobalVegetableColor() {
    return new CRGBA(nel3dJNI.CLandscapeUser_getDLMGlobalVegetableColor(swigCPtr, this), true);
  }

  public void enableReceiveShadowMap(boolean state) {
    nel3dJNI.CLandscapeUser_enableReceiveShadowMap(swigCPtr, this, state);
  }

  public boolean canReceiveShadowMap() {
    return nel3dJNI.CLandscapeUser_canReceiveShadowMap(swigCPtr, this);
  }

  public void addTileCallback(ULandscapeTileCallback cb) {
    nel3dJNI.CLandscapeUser_addTileCallback(swigCPtr, this, ULandscapeTileCallback.getCPtr(cb), cb);
  }

  public void removeTileCallback(ULandscapeTileCallback cb) {
    nel3dJNI.CLandscapeUser_removeTileCallback(swigCPtr, this, ULandscapeTileCallback.getCPtr(cb), cb);
  }

  public boolean isTileCallback(ULandscapeTileCallback cb) {
    return nel3dJNI.CLandscapeUser_isTileCallback(swigCPtr, this, ULandscapeTileCallback.getCPtr(cb), cb);
  }

  public void setZFunc(SWIGTYPE_p_UMaterial__ZFunc val) {
    nel3dJNI.CLandscapeUser_setZFunc(swigCPtr, this, SWIGTYPE_p_UMaterial__ZFunc.getCPtr(val));
  }

  public CZone getZone(int zoneId) {
    long cPtr = nel3dJNI.CLandscapeUser_getZone(swigCPtr, this, zoneId);
    return (cPtr == 0) ? null : new CZone(cPtr, false);
  }

  public float getRayCollision(CVector start, CVector end) {
    return nel3dJNI.CLandscapeUser_getRayCollision(swigCPtr, this, CVector.getCPtr(start), start, CVector.getCPtr(end), end);
  }

  public CLandscapeModel getLandscape() {
    long cPtr = nel3dJNI.CLandscapeUser_getLandscape(swigCPtr, this);
    return (cPtr == 0) ? null : new CLandscapeModel(cPtr, false);
  }

}
